package com.seculab.board.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seculab.board.domain.Board;
import com.seculab.board.domain.Comment;
import com.seculab.common.dao.DefaultDAO;

@Service
public class BoardServiceImpl implements BoardService {
	
	@Autowired
	private DefaultDAO defaultDAO;

	@Override
	public void insertBoard(Board board) throws Exception {
		defaultDAO.insert("Board.insertBoard", board);
	}

	@Override
	public List getBoardList(Board board) throws Exception {
		return defaultDAO.selectList("Board.getBoardList", board);
	}

	@Override
	public Map<String, Object> getBoard(Board board) throws Exception {
		return (Map<String, Object>)defaultDAO.select("Board.getBoard", board);
	}

	@Override
	public void updateBoard(Board board) throws Exception {
		defaultDAO.update("Board.updateBoard", board);
	}
	
	@Override
	public void insertComment(Comment comment) throws Exception {
		defaultDAO.insert("Board.insertComment", comment);
	}	
	
	@Override
	public List getCommentList(Comment comment) throws Exception {
		return defaultDAO.selectList("Board.getCommentList", comment);
	}	
	
	@Override
	public Map<String, Object> getComment(Comment comment) throws Exception {
		return (Map<String, Object>)defaultDAO.select("Board.getComment", comment);
	}	
	
	@Override
	public int deleteComment(Comment comment) throws Exception {
		return defaultDAO.delete("Board.getComment", comment);
	}	
}
